package org.ctgu.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.ctgu.entity.User;

@Mapper
public interface UserMapper {

    /**
     * 根据用户名查询用户
     * @param username
     * @return
     */
    @Select("select * from user where username = #{username}")
    User getByUsername(String username);

    /**
     * 新增用户
     * @param newUser
     */
    @Insert("insert into user(username, password, role, create_time, update_time) values (#{username}, #{password}, #{role}, #{createTime}, #{updateTime})")
    void insert(User newUser);
}
